﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Mammoth.Entities;
using NHibernate.Mapping.ByCode;
using NHibernate.Mapping.ByCode.Conformist;


namespace Mammoth.Mappings
{
    public class InboxEntityMapping : EntityMapping<InboxEntity>
    {
        public const int MessageLength = 2000;

        public InboxEntityMapping()
        {
            Table("tabel_inbox");
            Property(x => x.Message, m => m.Length(MessageLength));
            ManyToOne<AccountEntity>(x => x.Service,
                m =>
                {
                    m.Column(c => c.Name("AccountId"));
                    m.Lazy(LazyRelation.NoLazy);
                });
            ManyToOne<BuddyEntity>(x => x.Buddy,
                m =>
                {
                    m.Column(c => c.Name("ClientId"));
                    m.Lazy(LazyRelation.NoLazy);
                });
        }
    }
}
